// pages/logistics/logistics.js
var ports = require("../../utils/ports.js")
var app = getApp()

Page({

  /**
   * 页面的初始数据
   */
  data: {
    status:'',
    mydetail:{},
    logisticsInfo:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    var id = options.id
    //获取订单详情
    var data = {}
    data.sessionID = wx.getStorageSync('USER_SESSIONID'),
    data.memberOrderID = id,
    data.type = 1,
    ports.ModuleMemberOrder.getMemberOrderDetail(data,that,res=>{
      if (res.data.header.code == 0){
        var mydetail = res.data.body.data
        var status = res.data.body.data.status
        that.setData({
          status: status,
          mydetail:mydetail
        })
        that.getExpNoInfo()
      }
    })
  },
  //获取物流信息
  getExpNoInfo(){
    var that = this
    var data = {}
    data.expCode = that.data.mydetail.expCode,
    data.trackingNo = that.data.mydetail.sendCode,
    ports.ModuleMemberOrder.getExpNoInfo(data,that,res=>{
      var logisticsInfo = res.data.body.tracesDtoList
      that.setData({
        logisticsInfo: logisticsInfo
      })
      console.log(res.data.body.tracesDtoList)
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})